package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import org.owasp.esapi.ESAPI;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class AreaShowRequest extends Request {
	
	private String province;
	private String city;
	private String district;

	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		//获取地区信息
		this.province = StringUtil.fixHtml(requestInfo.getParameter(ApiUrlParamEnum.province.getParamName()));
		this.city = StringUtil.fixHtml(requestInfo.getParameter(ApiUrlParamEnum.city.getParamName()));
		this.district = StringUtil.fixHtml(requestInfo.getParameter(ApiUrlParamEnum.district.getParamName()));
		if(StringUtil.isEmpty(province) && StringUtil.isEmpty(city) && StringUtil.isEmpty(district)) {
			throw new RequestIllegalException("缺少必要参数，请确认");
		}
	}
	
	public String getProvince() {
		return province;
	}


	public void setProvince(String province) {
		this.province = province;
	}


	public String getCity() {
		return city;
	}


	public void setCity(String city) {
		this.city = city;
	}


	public String getDistrict() {
		return district;
	}


	public void setDistrict(String district) {
		this.district = district;
	}

}
